package com.hx.portal.controller.hospital;

import com.alibaba.dubbo.config.annotation.Reference;
import com.hx.common.result.PageResult;
import com.hx.common.result.Result;
import com.hx.hospital.pojo.Banner;

import com.hx.hospital.service.BannerService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/banner")
public class BannerController {

    @Reference
    private BannerService bannerService;

    @GetMapping("/findAll")
    public List<Banner> findAll(){
        return bannerService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<Banner> findPage(int page, int size){
        return bannerService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<Banner> findList(@RequestBody Map<String,Object> searchMap){
        return bannerService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<Banner> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  bannerService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public Banner findById(Long id){
        return bannerService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody Banner banner){
        bannerService.add(banner);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody Banner banner){
        bannerService.update(banner);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(Long id){
        bannerService.delete(id);
        return new Result();
    }

}
